Skip to content

chore(upstream): sync with upstream CodeGraph v1.6.5 (3.1.0) - #343

Merged
ardelperal merged 1295 commits into
mainfrom
sync/upstream-v1.6.5
Nov 29, 2026
Merged

ardelperal merged 1295 commits into
mainfrom
sync/upstream-v1.6.5

Conversation

@ardelperal

Copy link
Copy Markdown
Owner

Closes #331

Integrates upstream CodeGraph v1.6.5 (1291 upstream commits since the v1.4.1 base) into the VBA fork, keeping the fork's VBA/Access/Dysflow behaviour. Fork version 3.1.0.

How it was done

The codegraph-vba-upstream-sync procedure:

  • Isolated branch, plus rollback tag pre-upstream-sync-v1.6.5 (= v3.0.0).
  • The sync starts from the verified upstream tag.
  • 60 conflicts, all in shared files; no VBA-only file conflicted. Every one is classified by hand: 24 core (where VBA hooks into extraction, resolution and the database) and 36 infra.

Seams fixed so upstream code does not silently break VBA

Risk Fix
Migration numbers collide (upstream 9/10 vs fork metadata 9/10) Upstream 9-16 kept as is. The fork columns move to 17/18, idempotent. Existing fork databases are reconciled by column/table existence.
Upstream bulk writes and the array-row reader dropped metadata Metadata is written and read on every path, including the store worker and the parallel resolver
Upstream store worker deleted [Event Procedure] edges (431 → 49 on a real corpus) VBA event-handler edges are preserved, with a test
Synthesis refresh deleted every VBA-synthesized edge on the first sync VBA provenance is excluded from synthesis ownership
Kernel kind-table equality forced the wasm path for every language Kernel tables accepted as a prefix; VBA kinds appended
Upstream test-suite filter would drop edges into Dysflow Test_*.bas Skipped for VBA
Two extraction-version counters One counter = max + 1 (30); every index reindexes once

Fork decisions kept

  • Package identity, the release pipeline and pnpm. A pnpm-workspace.yaml was added for upstream's ui/ viewer.
  • #332 upgrade behaviour.
  • The OpenCode mcp.codegraph entry that gentle-ai recognises.
  • The #193 status wording.
  • serverInfo as emitted by 3.0.0.
  • Upstream's Pro beta signup is disabled: nothing is sent to getcodegraph.com.

Verification

  • VBA graph parity on a real 163-file Access corpus:
    • Node counts per kind are identical, and all 431 event-handler edges are kept.
    • 23,542 → 23,540 edges. The only 2 lost edges were bogus in v3.0.0: upstream's JSX pass read "<NPEDIDO>" inside a VBA string as a tag, and upstream now limits that pass to JS.
    • The independent verifier re-derived the v3.0.0 baseline itself and got a byte-identical result.
  • Migrations on real SQLite files: fresh DB, DB written by v3.0.0 (no data loss: identical hashes) and DB written by upstream v1.6.5 all reach v18; opening twice changes nothing.
  • Behaviour: incremental sync on VBA matches v3.0.0. CP1252 sources, daemon stop --path and fork identity all checked.
  • Full suite, run locally in 6 shards (Node 26): only the known Windows npm-sdk failures. CI on Node 22 is the authoritative run.
  • Native review: not possible, because the candidate is 3.2 M lines, mostly upstream code (lens_context_budget_exceeded). Per the owner's decision, RDD was disabled for this clone for this delivery; the independent verifier covered the fork-specific risk.

Reindex required (codegraph-vba index) after upgrading.

colbymchenry and others added 30 commits October 29, 2026 22:26
…oundary (#3029)

`codegraph affected --filter` turned its glob into an unanchored regex by
hand (`**` to `.+`, `*` to `[^/]*`, no `^` or `$`), so it matched anywhere
inside a path: `tests/**/*.py` missed `tests/x.py` (`.+` needs a folder),
a changed `tests/x.py.bak` counted as a test under `tests/*.py`, the
changed test itself was missed under `tests/**/*.py`, `e2e/*.spec.ts`
took an `xe2e/` folder, and `/tests/*.py` matched only `other/tests/...`.

The filter is now a picomatch glob (an existing dependency, loaded only by
this command) with `dot: true`, matched against the whole project-relative
path. A pattern with no slash matches the file name at any depth. One with
a slash matches from any folder boundary, an implicit leading `**/`, which
keeps the help text's own `e2e/*.spec.ts` matching `apps/web/e2e/...` as
the filter always did; a leading `/` or `./` anchors it at the project
root, and a trailing `/` takes everything under that folder. A pattern
picomatch rejects is reported as an invalid --filter instead of failing
later.

Validation: new CLI-level cli-affected-filter-globs tests (6): 4 fail on
main's source and pass with the fix; the other 2 guard behavior kept on
purpose (file-name patterns at any depth, folders outside the test
conventions, dotfiles, a trailing-slash folder). The existing affected
CLI suites pass. The triage fixture shows the same before and after.

Reimplements PR #1273 by @Jseca666.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…odegraph_node (#3030)

codegraph_node's multi-definition answer rendered a name's definitions in
index order (getNodesByName: file_path, start_line) until its caps ran
out: 16 bodies within 12,000 characters, then 20 list lines, then a bare
"+N more". Forty definitions under an early-sorting folder hid the only
one in another language or a late folder: on the triage fixture (40
TypeScript `num` in aaa_client/, one Python `num` in zzz_server/),
zzz_server/format.py appeared nowhere. Without includeCode, a long list
was cut by the output cap at "... (output truncated)".

The bodies still fill in index order, so every overload that rendered
before still renders. On top of them, each language with no body gets its
first hand-written definition rendered, while the whole answer stays
under the output cap. The list of the rest fills its 20 slots in a new
definitionCapOrder (the first definition of each language, then of each
top-level folder within a language, then the rest, each tier in index
order) and is shown in index order; the overflow line names what it
leaves out by language and folder, like "+365 more: 365 typescript in
aaa_client/". The list-only answer is unchanged unless it is longer than
the output cap; then it fills in the same order and names the rest the
same way. Generated stubs stay behind hand-written definitions.

Promoting each folder's first definition into the bodies, as first
tried, cost Alamofire's `validate` three Validation.swift overloads to a
Tests/ helper, and `adapt`, `urlSession`, `encode` and `cancel` one or
two Source/ bodies each, so folders get early list slots only.

Validation: new node-overload-spread tests (6): 5 fail on main's source
(the fits-every-cap guard passes on both) and all pass with the fix. A/B
of every multi-definition name, with and without includeCode, main vs
fix: gin 171 names, 170 identical (`_` only names its overflow);
Alamofire 706 names, 702 identical. No body that rendered before is lost:
`cancel` adds the jQuery `cancel` from docs/ as a 13th body, and
`request`, `urlSession` and `encode` swap one Source/ list line for the
first Tests/ one and name their overflow. Alamofire's `validate`, `task`
and `didCompleteTask` and gin's `reset`, `Bind` and `Render` are
byte-identical.

Reimplements PR #1657 by @ferrine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…low and context (#3031)

The index stores a name in any script as one full-text token, and
`codegraph query 로그인` found it, but every tokenizer between a question
and the index knew only ASCII: extractSearchTerms split on [^a-zA-Z0-9]
and kept 3+ characters, context's extractSymbolsFromQuery matched ASCII
patterns only, and explore's exploreQueryTokens and the Flow's flowTokens
required a leading [A-Za-z_$] and 3+ characters. So `explore 寻路服务`
answered "No relevant code found", `context 로그인` printed only its
header and `explore 入口 末端` had no Flow, while their ASCII twins worked.

Shared helpers in search/query-utils now read words in any script whole:
letters, digits and combining marks, cut where Han, kana or Hangul meets
another script (NavMeshAgent类型 is NavMeshAgent and 类型, never
agent类型), at least 2 characters in Han, kana or Hangul and 3 elsewhere,
so Russian на and из stay out. extractSearchTerms and the explore and
Flow tokens use them. Context adds names with a non-ASCII letter as whole
runs, and a mixed name like get用户信息 as written, with no n-grams, so
a partial Chinese word still never becomes a search of its own (PR #2005).
The ASCII-only patterns see a word with accented or other non-ASCII
letters blanked out, so état is no longer read as tat. A Han, kana or
Hangul token counts as a deliberately named identifier, as such a name
has no case or underscore to show it, so a query of such names is
neither damped as prose nor flagged low-confidence.

Validation: new cjk-query-tokens tests (12) cover CJK, mixed, Cyrillic
and accented words, reference copies of the old tokenizers over an ASCII
corpus, and explore and context end to end on Korean, Chinese and
Japanese fixtures; 9 fail on main's source. Explore and context A/B with
214 ASCII queries (gin 76, Alamofire 79, express 59; 49 lead with a
Flow): all byte-identical. Of 12 non-ASCII queries, 6 changed on gin and
4 on express, as intended: état, Señal and naïve are read whole, and
handleHTTPRequest处理 now names handleHTTPRequest. Tokenizing a
10,000-character query takes at most 1.8 ms, against 0.1-0.3 ms before.

Reimplements PR #516 by @andy-sg and PR #1262 by @yimingll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(#3043)

Both extractors created a Go var/const node from its var_spec or
const_spec without exportedness: the TS Go branch passed no isExported
(the declaration-level value is read off the var_declaration, which has
no name), and the kernel's extract_variable set none. Every such node was
unexported, so findGoPackageMember, which looks up pkg.Name among the
package's exported declarations, skipped it: a call through
`var Hook = func...` from another package linked to nothing, though the
same call inside the package linked to the variable.

Both engines now mark the node exported by its own name's case, read
from the spec through goExtractor.isExported / is_exported, as
functions, methods and types already were.

Validation:
- __tests__/go-package-value-exported.test.ts, 16 tests (extraction on
  the kernel and wasm, LF and CRLF; cross-package calls on both paths):
  12 fail on the base main, 6 with only the TS half (the kernel
  checks), all pass with the fix.
- A/B, main vs fix, kernel path: gin 108 var/const flags, 0 edges;
  prometheus 625 flags, 0 edges; etcd 806 flags and 12 new calls,
  all right (e2e.GetVersionFromBinary x11 and
  model.NonDeterministicModel, both `var X = func(...)`); flask and
  express byte-identical. The fix's kernel and wasm graphs are
  byte-identical on all three Go repos, and the wasm A/B matches.
- kernel-parity --lang go: gin 99/99, prometheus 755/755, etcd
  1065/1105 with 40 deferred on main too; 0 diffs.
- etcd index time, median of 3 interleaved: 13.4 s main, 12.6 s fix.

Reimplements PR #1521 by ericquan8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tats (#3045)

GitHub reports the repository as 79% C and 18% TypeScript. Nearly all of
that C is the third-party tree-sitter grammars the native kernel compiles
from source (codegraph-kernel/grammars/, 29 files, about 78 MB).

A new .gitattributes marks every file under codegraph-kernel/grammars/
linguist-vendored, so Linguist leaves them out of the language
statistics, and marks the five generated parser.c files
linguist-generated, so pull requests show those collapsed. The
hand-written scanner.c files stay expanded in diffs on purpose: that is
where C gets patched or added (PR 2173, and the open PR 2866), and every
contributor PR is security-reviewed, so such a change must stay visible.
The patterns use /** because an attributes pattern that names a
directory does not reach the files inside it.

Validation: git check-attr over all 1,722 tracked files reports
linguist-vendored set on exactly the 29 files under
codegraph-kernel/grammars/ and linguist-generated set on exactly the
five parser.c files; scanner.c, the headers and the LICENSE files are
vendored only, and everything else, src/index.ts included, has neither.
In a scratch repository the bare directory pattern leaves parser.c
unspecified. Git does not act on linguist attributes and codegraph never
reads .gitattributes, so builds and tests are unaffected.

Raised by PR 2513 (@build8421) and PR 1668 (@kidonng).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t that module (#3046)

A Python call through a name the file imports as a module, like
other.update(...) after `from pkg import other`, linked to the module's
function whatever the calling function bound `other` to: a parameter, a
local, a with/except/loop target, a walrus, a case capture, a lambda or
comprehension variable. resolveViaImport read the file's import mappings
alone (its only scope check, pythonFunctionModuleAlias from PR #2600,
covers a function-local `import a.b as X`), and isPythonProjectModule,
which lets a builtin-named call like update/get/write past the builtin
filter for a project module, asked the same file-wide question. The
mappings also list from-imports at any depth ahead of plain imports, so a
function-local `from pkg import third as other` became every function's
`other`.

pythonReceiverBinding reads how the code around a reference binds the
name: the reference's own statement (lambda parameters, comprehension
targets), then each enclosing function, innermost first, through its
parameters and own statements (assignment, annotation, for, as, walrus,
del, nested def/class, case captures, imports; global keeps the module's
binding), memoized per function. pythonImportsInScope gives
resolveViaImport's Python branch and isPythonProjectModule only the
receiver's mappings that apply there.

Validation:
- __tests__/python-receiver-rebinding.test.ts, 80 tests (default and
  wasm, LF and CRLF): 48 fail on the base main (ten rebinding shapes,
  the local from-import, the cross-function leak), 32 pass (look-alikes:
  keyword argument, string, comment, comprehension over the module, lambda
  beside the call, global, keyword pattern, same-module local import);
  all pass with the fix. The 26 Python-related test files pass.
- A/B, main vs fix: django's own package (930 files, kernel path) changes
  2 edges' confidence (0.85 to 0.8, same targets: a closure over a
  parameter `apps` and a local `apps = model._meta.apps`); flask drops
  one cli.group() call and lowers 4 to 0.7 with the same targets (a
  nested `def cli` and a pytest fixture parameter `app` named like
  imports); requests, click, mealie and fastapi (package plus tests), and
  the express and gin controls are byte-identical.
- django package index time, median of 3 interleaved: 11.3 s main,
  10.7 s fix.

Reimplements PR #2632 by BGamboa13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k their method (#3049)

Two kinds of Ruby call linked nothing. A call to a method whose name ends
in `!` or `?` on a receiver (`writer.flush!`, `writer.ready?` after
`writer = CacheWriter.new`, `CacheWriter.create!(1)`) failed the method-call
pattern, whose method part took no `!` or `?`. A method called straight on
a new object (`CacheWriter.new(key).write_cache`, `Billing::Ledger.new.charge!`)
was recorded by both extractors with the receiver's raw text, arguments and
blocks included, which no strategy matched.

Both extractors now record a call on `Const.new(...)`, `A::B.new` or
`::Foo.new` as `new Const().m`, the constructed-receiver shape TS/JS, Java
and C# already use; the wasm extractor and the kernel's ruby.rs emit the
same refs. ruby-constant-paths resolves that shape before the name
pre-filter: the class by Ruby's constant lookup from the namespaces around
the call, the method as the class's own instance method or the first its
ancestry declares, and nothing when either is missing, so rack-protection's
`Request.new(env)` (rack's Rack::Request) links nothing. The Ruby dot pattern
in matchMethodCall takes a trailing `!` or `?`; the receiver-word scoring
among several project methods of the name stays off for such names on a
value receiver, where it was wrong on 55 of 74 new edges (`options.key?`
on a Hash -> InheritableOptions#key?). rubyAncestry no longer reads a
module a call returns (`include RouteSet.new.tap {...}.url_helpers`) as a
mixin of the constant the call starts at.

Validation, kernel engine, main 37052b1 vs this change:
- sinatra cb22afd +12, jekyll 97c3bdc +53, activesupport +398,
  actionpack +97 (2 removed: `ActionController::Base.with` had reached
  RoutesHelpers.with through a misread mixin), activerecord +1012
  (rails 793d744 subtrees). About 21 of 1,572 added edges are wrong, all
  from the class-name and single-method guesses that plain names get too.
- Controls requests (Python) and cobra (Go): dump-graph byte-identical.
- kernel-parity.mjs: fixtures 10/10, sinatra 147/147, jekyll + rails
  1044/1044 files byte-parity, none deferred.
- New tests: 10 fail with main's kernel and TS, all pass with the fix, in
  both engines. Dropping the scoring gate or the mixin fix fails its guard
  test.
- Index time, median of 3 interleaved: activesupport 5.35 vs 4.63 s,
  jekyll 2.66 vs 2.73 s (noise).

Reimplements PR #684 by @ricobl, who found both gaps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… unused types package (#3044)

devalue 5.9.1 (root, through svelte) and 5.8.1 (site/, through astro)
fall in seven advisories published 2026-10-01 and fixed in 5.9.3, among
them GHSA-j22f-vq7h-c4qm (CVE-2026-92708, high). postcss 8.5.6 (root,
through vite) and 8.5.15 (site/) fall in GHSA-r28c-9q8g-f849
(CVE-2026-73646, high, fixed in 8.5.18) and GHSA-fxqj-rqcc-2cmp (fixed
in 8.5.23); the root copy also in GHSA-6g55-p6wh-862q and
GHSA-qx2v-qp2m-jg93. All of these are build-time dependencies.

Lockfile-only updates inside the existing ranges: npm update devalue and
npm update postcss, in the root and in site/. devalue goes to 5.9.4 and
postcss to 8.5.32, whose own ranges move nanoid to 3.3.20 and
source-map-js to 1.2.2, which clears their advisories as well
(GHSA-28wg-ghj8-5hjv, GHSA-2v37-7h3g-55p8, GHSA-68fv-2mgg-jv7q). The
@types/better-sqlite3 devDependency goes: nothing has imported
better-sqlite3 since the switch to node:sqlite. In site/, npm 10 also
drops five "peer": true markers that the npm which wrote that lockfile
had added; they are metadata only, and npm ci installs the same tree.

Validation:
- npm audit: root 14 advisories before, 10 after; site/ 13 before, 9
  after. devalue, postcss, nanoid and source-map-js are gone from both.
- npm run build on main's lockfile and on this one: all 1,264 files of
  dist/, the viewer included, are byte-identical. The site builds its
  21 pages, and its 101-file dist/ is byte-identical too.
- The release bundle's install (npm ci --omit=dev --ignore-scripts on
  the staged lockfile) installs the same 12 packages, file for file.
- All 8 changed resolved/integrity entries match the npm registry's own
  metadata and sit on registry.npmjs.org. No git, URL or tarball
  sources, and no new install scripts. devalue, postcss and nanoid carry
  provenance from their own repositories' release workflows.

Raised by PR 2885 (@johnhldiver-beep) and PR 1477 (@anupamme).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


[skip actions]
…dows, and takes CODEGRAPH_BIN (#3047)

scripts/add-lang/verify-extraction.mjs ran execFileSync('codegraph', ...).
On Windows, npm installs codegraph as a .cmd shim (so do npm link and
local-install.sh), and Node neither finds a .cmd by bare name nor runs
one without a shell. The check always died with "spawnSync codegraph
ENOENT" (exit 2), and /add-lang's bench.sh read that as broken
extraction and skipped its A/B.

The script now asks, in order:
- CODEGRAPH_BIN, when set. A .js, .mjs or .cjs path runs with the
  current node; anything else runs directly (a .cmd or .bat through
  cmd.exe).
- On Windows, the codegraph Windows itself would pick: the first PATH
  folder holding codegraph under one of PATHEXT's runnable extensions.
  A .cmd or .bat runs through cmd.exe (shell: true) as one command
  string. Each token is quoted for the C runtime and caret-escaped for
  cmd, so spaces, &, parentheses, a %NAME% and a trailing backslash in
  the repo path arrive intact. An .exe or .com needs no shell.
- Otherwise codegraph by bare name, exactly as before. On macOS and
  Linux without CODEGRAPH_BIN, the call and the output are unchanged.

bench.sh takes CODEGRAPH_BIN too. It makes a path absolute (indexing
runs from inside the repo), exports it so verify-extraction.mjs reads
the index with the same build, and runs its own --version and init calls
with it. Without it, bench.sh behaves exactly as before. The A/B's MCP
server stays run-all.sh's own CG_BIN.

Validation (Windows 11, Node 22.22.0):
- New __tests__/add-lang-verify-extraction.test.ts covers CODEGRAPH_BIN
  with a .js stand-in (all platforms), a .cmd shim on PATH with an
  awkward repo path (Windows only), and the bare-name call (macOS and
  Linux only). With main's script both tests that run here fail ("could
  not read codegraph status"); with the fix, 2 pass and 1 is skipped.
- The fixture from PR 1246's review (a codegraph.cmd on PATH): main
  exits 2 with ENOENT; the fix reads the status.
- 13 scenarios with npm's own generated shims, and a real index in a
  folder named "lua repo & co (x86) 100%": main fails every one that
  needs the shim or CODEGRAPH_BIN, and the fix passes them with the
  exact argv reaching codegraph. With no codegraph anywhere, both exit 2
  the same way.
- bench.sh with the A/B stubbed: with npm link's shims on PATH, main's
  copy skips the A/B (verify exit 2) and the fix reaches it (PASS).
  CODEGRAPH_BIN as an absolute or a relative path reaches it too, and a
  missing one stops with a clear message.
- With process.platform reported as linux or darwin, main's script and
  the new one make the same execFileSync call and print the same output.

Raised by PR 1246 (@bslatner).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ct expression is an anonymous class (#3051)

A supertype written through its enclosing type was lost in three ways.
Java and C# kept the dotted path (class Named extends Outer.Inner,
class N : Outer.IListener), but the qualified-name match compared it
verbatim with p::Outer::Inner, so it stayed unresolved; a Java anonymous
class (new Api.Listener() {...}) kept only the last segment, which no
nested type is found by; and Kotlin (both engines) took the FIRST
segment, so class K : Outer.Inner() extended Outer. A Kotlin object
expression, object : Listener {...}, made no class at all: its overrides
became local functions of the code around it, which a call through the
interface never reached, and bare calls elsewhere could be guessed onto
them.

A dotted Java, Kotlin or C# supertype now resolves to the type whose
qualified name ends with the path, when the file can name the path's
first type (its own file, package or namespace, an import; C#'s usings);
of several, the one closest in the tree, or none on a tie. The Java
anonymous class keeps the written path in its extends reference, and
Kotlin joins every segment of a supertype (type arguments left out), in
the wasm extractor and the kernel alike. A Kotlin object expression is
indexed as Java's anonymous class is: a class <Listener$anon@line> that
extends each supertype as written, which the code around it
instantiates (the class it builds, else its first supertype, also as
written and only ever a type that can be a supertype), with its body's
declarations as members; its header (constructor arguments, a
by-delegate) stays the enclosing code's. An anonymous class's members,
Java's and Kotlin's, are named only inside the declaration holding the
class: a bare block() elsewhere is never an object's override val block.

The walk up a Java or Kotlin class's supertypes for an inherited method
asks each supertype by the chain of types that names it
(AssistantMessage::Builder) before its simple name, so a builder's
build() is its own AbstractBuilder's and not an MCP annotation's;
the name still answers when an extends edge reached a namesake
(Minestom's Player extends LivingEntity).

The code in an object expression still sees the scope it is written in,
as when its overrides were local functions: a property of the class
around the object types a receiver there (okhttp's server.url() in an
object : Callback is MockWebServer's), an override is not what a call
of its own name in it means (original!!.contentLength(),
this@Outer.onScroll(), an extension receiver's onDataChanged()), and an
object's members out of reach leave a by-name guess as it was
(okhttp's it.isReady() is still the SerialTask interface's).

Validation:
- jvm-dotted-supertypes.test.ts: 13 tests, 11 fail on main 60b0d7a
  (the other two guard a dotted supertype the file cannot name and the
  calls inside an anonymous class), all pass here.
- Kernel parity, 0 files with diffs: torture.kt 1/1, Torture.java 1/1,
  okhttp 588/619 Kotlin and 71/71 Java, mihon 891/940, nowinandroid
  340/350, SystemUI 188/198 Kotlin and 1141/1141 Java, jextract 218/218,
  Minestom 1859/1894 (deferrals are main's).
- A/B against main 60b0d7a, sites added/removed/retargeted: okhttp
  +640/-53/149, SystemUI +435/-53/116, Minestom +165/-3/6, kestra
  +108/-0/6, spring-ai +46/-0/38, playframework +27/-3/13, mihon
  +22/-5/6, jextract +22/-0/1, spring-modulith +9/-0/10, nowinandroid
  0/0/0; serilog, click, gin identical.
- Cost (median of 3 interleaved): okhttp CPU 27.8 -> 29.0 s, wall
  8.6 -> 8.8 s (its 360 object classes and 1,491 more edges); mihon
  23.6 -> 23.8 s, wall 7.8 -> 7.7 s.

Reimplements #1927 by @mixxer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (#3050)

codegraph applies .gitignore rules itself, through the ignore package:
on the filesystem walk for every .gitignore, and in git repositories on
top of git ls-files for its built-in defaults merged with the root
.gitignore and git's exclude files. codegraph.json's include, exclude
and includeIgnored patterns go through it too. ignore 7.0.5 read several
forms differently from git: a backslash escape (\d was a regex digit),
POSIX classes and a ] or ! first in a bracket, and a run of three
asterisks. A lone ! line matched every path, so it re-included
everything the rules and the built-in defaults leave out, node_modules
included. 2,031 of 200,000 random patterns also threw at match time,
which readGitignorePatterns has to guard against (issue 682).

ignore 7.0.14, with the range raised to ^7.0.14, reads all of these as
git does, and none of the 200,000 patterns throws. Its code diff from
7.0.5 was read in full: pattern translation only, with no I/O, no
dependencies and no install scripts. The lockfile entry matches the npm
registry's own metadata on registry.npmjs.org. The package has no
provenance, like every release its maintainer has published.

Validation:
- New __tests__/gitignore-pattern-parity.test.ts checks scanDirectory
  against git's own answer for these patterns, on the filesystem walk
  and in a git repository: its 4 tests fail with 7.0.5 and pass with
  7.0.14.
- scanDirectory on react, astro and django, in git mode and in walk
  mode on a copy without .git, returns the same 4,631, 4,946 and 3,027
  files with either version.
- On a fixture of the changed forms, 7.0.14 leaves out exactly what git
  leaves out in both modes, node_modules aside, which codegraph's
  defaults always exclude. With a lone ! line, 7.0.5 kept 16 of the 18
  files on the walk, node_modules among them, where git keeps 6. Without
  that line it differed from git on 8 files on the walk and on 2 in git
  mode.
- The gitignore and scope test files (extraction,
  git-ignored-dirs-scope, the include, exclude and includeIgnored
  configs, src-build-folders and others): 853 passed.

Raised by PR 2885 (@johnhldiver-beep).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…one candidate is judged by family (#3052)

Name matching compared a candidate's raw language tag with the
reference's: the single-candidate confidence in matchByExactName and
matchFuzzy, and findBestMatch's same-language skip and +50/-80 score.
So a call whose name had several definitions in another of C, C++ and
Objective-C scored -80 for each and linked to nothing (an Objective-C
file's _glfwPlatformSetTls(), a C++ call into Dear ImGui's imgui.h, which
reads as C), and the one definition of a name across TSX and TS, or C and
C++, was a 0.5 cross-language guess.

The single-candidate confidence now compares language families
(sameLanguageFamily). Ranking treats C, C++ and Objective-C as one
language (sameRankingLanguage), the very language worth a point that only
breaks a tie; other families keep the language itself, because ranking
them by family moved excalidraw's Store::scheduleCapture calls to the
App.tsx method beside them and gave okhttp 83 wrong Java-to-Kotlin
Builder picks.

Validation:
- __tests__/name-match-language-family.test.ts, 8 tests (default and
  wasm): 6 fail on the base main; the pin that a .ts call keeps its .ts
  target over a .tsx namesake beside it passes on both; all pass with
  the fix. 24 related test files (cross-language, React Native, Expo,
  Fabric, frameworks, mixed TS/JSX, Objective-C, resolution): 746 pass.
- A/B, main vs fix: glfw +4 calls from Objective-C into C, imgui +93
  from C++ into imgui.h (read as C) and imstb_rectpack.h, all to the
  definitions meant; excalidraw, okhttp, leveldb and jq gain or lose no
  edge (43, 9, 97 and 30 unique-name links go from 0.5 to 0.9 with the
  same targets); flask and gin byte-identical.
- Index time, median of 3 interleaved: imgui 7.9 s main, 7.7 s fix;
  excalidraw 9.2 s main, 9.4 s fix.

Reimplements PR #1662 by ferrine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… to its class's method (#3053)

Both extractors record a Ruby call on an instance variable as
`@writer.flush`, and no strategy read the variable's type, so every such
call stayed unresolved: 2,780 in activesupport and 3,239 in actionpack on
main, for example.

ruby-constant-paths now resolves `@name.m` written in an instance method of
a class (not a class method, not a module) by the class's `initialize`.
When every assignment to `@name` there starts a statement and is a lone
`Const.new(...)`, `A::B.new` or `::Foo.new ...` of one constant
(arguments with or without parentheses, a block or a statement modifier
may follow), the class is the one Ruby's constant lookup finds for it from
`initialize`, and the method is that class's own instance method or the
first its ancestry declares. Anything else leaves the variable untyped for
the other strategies, as before: a conditional, two classes, `.tap`,
`writer || Foo.new`, `@a, @b = ...`, a chain continued on the next line. A
class the project doesn't declare (`Logger.new($stdout)`) links nothing.

Validation, kernel engine, main 3a4cd3b vs this change:
- jekyll 97c3bdc +8, activesupport +19, actionpack +14, activerecord +30
  (rails 793d744 subtrees), sinatra cb22afd 0; nothing removed. 68 of the
  71 are right; 3 in activerecord follow `@pool = NullPool.new` from
  `initialize`, which `pool=` later replaces with the real pool.
- Controls requests (Python) and cobra (Go): dump-graph byte-identical.
- New tests fail with main's resolver (the positive case, in both engines)
  and pass with the fix; the untyped and outside-class cases pass on both.
- Index time, median of 3 interleaved: activesupport 4.72 vs 4.79 s,
  activerecord 11.54 vs 11.54 s.

The gap was found in the triage of PR #684.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s own function (#3025)

A Rust call through a type, `sim::items::ItemPool::for_def(…)` into another
crate of the workspace or `ItemPool::for_def(…)` under `use
sim::items::ItemPool;`, was matched by its qualified name alone, so a
namesake type's function in another crate or module could take it (a
workspace's `client` crate's `ItemPool::for_def`). The module walk stopped
at the type, a `use` of a `pub const` or `static` (`use sim::RANK_COUNT;`)
linked nothing, and a type rustfmt wrapped below its path (`h:
&scheduler::\n Handle`) linked by the file's `use` of its last name.

The fix, on the module walk:
- rustPathTarget reads `Type::member` calls: the type is the item the
  path's modules name, or the one the `use` that binds its name names
  (rustUseItemsAt), and rustTypeMember finds its member: an enum's variant;
  else the type's own (inherent) function or `const` in the type's crate,
  a trait impl's only when it is the one of that name; a trait's own
  declared method. A type alias, `Self`, a type the module declares itself
  and a type path in any other position are left as they were.
- Module items include `variable`s (a module-level `pub const`/`static`).
- matchRustUseBoundName reads a qualifier written on the line above a
  type (rust-scopes' blanked code, so a commented-out path is none) and
  resolves the whole path.
- Memoized per (type, member) and per path.
- Manifest paths stay inside the project: a workspace member that leaves
  it (`../sibling`, an absolute path) is neither read nor listed
  (escapesRoot, in expandMembers), and rustCrateGraph drops a
  `[lib]`/`[[bin]]` path that leaves it, as it already did a dependency's.

Validation:
- rust-cross-crate.test.ts (PR 2631's 9 cases, credited),
  rust-type-member-paths.test.ts and rust-manifest-paths.test.ts: on main
  10 of 15 fail; all pass. Every rust-* suite passes. On main the workspace
  map read `../outside/Cargo.toml`, `../vendor/x/Cargo.toml` and
  `/abs/crate/Cargo.toml` and listed `../vendor`; now only the project's.
- A/B against main, native kernel, 7 Rust repos (every site the same
  as against PR #3014's own commit; re-checked on 60b0d7a): tokio +205
  links / 139 retargeted / 230 chains gaining their head call, ripgrep
  +155 / 13 / 1, axum +25, clap +179 / 0 / 295, serde +28, dioxus +142 /
  6 / 31, gleam +114 / 47 / 0; 0 removed. Retargets go to the type the
  code imports or its own crate's (tokio's Semaphore::new and loom mocks
  to tokio::sync, ripgrep's Error::from, gleam's Printer::new); express
  and flask byte-identical.
- Cost, native kernel, medians of 3 interleaved runs (dioxus of 7):
  tokio CPU 32.1 -> 29.7 s, peak RSS 1,000 -> 1,010 MB; gleam 29.1 ->
  28.1 s, 1,010 -> 1,004 MB; dioxus 38.7 -> 40.1 s, 1,111 -> 1,115 MB
  (timed on one thread, rustPathTarget 1.24 -> 1.32 s over 17,198 calls).

Builds on PR #2631 by @BGamboa13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he method of the field's type (#3055)

A Java call written through a type's static field, Consts.HELPER.go()
or Holder.SHARED.run(), was resolved by the method's name alone: the
receiver Type.FIELD said nothing of its type, so the call went to a
same-named method of whatever class the name matcher found, and a field
of a library class (Intent.ACTION_VIEW.equals(...), System.out.print())
could reach a project method of that name. An interface's constants were
not indexed at all (neither engine read a constant_declaration), so a
constant a type declares in an interface, or inherits from one, had no
declaration to read.

A Java Type.FIELD.m() (Outer.Inner.FIELD.m(), a package written in
front) now finds the type as the calling file names it (javaTypeRef),
then the field, the type's own or one it inherits (five levels up), and
calls the method on the value the field's declaration gives it, read
with the field's own file's imports: an enum constant's own override,
else the enum's method; the method of the anonymous class the field is
initialized with (a CREATOR's createFromParcel); the class a new X(...)
initializer builds; else the type the declaration writes. A Kotlin
object's INSTANCE or Companion reaches the object's member. A library
owner, or a field of a library type, links nothing. A receiver whose
head is a local or a field links as before. Both engines index an
interface's constant_declaration as a static final constant.

Validation:
- java-static-field-receivers.test.ts: 9 tests, 7 fail on main 60b0d7a
  (two already pass there: a field typed by its own declaration and an
  anonymous class's method), all pass here.
- Kernel parity (java), 0 files with diffs: Torture.java 1/1,
  TortureRecord.java 1/1, jextract 218/218, spring-modulith 682/682,
  SystemUI 1141/1141, okhttp 71/71, Minestom 1859/1894 (deferrals are
  main's).
- A/B against main 60b0d7a, sites added/removed/retargeted (conf-only):
  Minestom +26003/-8/122 (751; 12,584 interface constants now indexed,
  409 calls typed), spring-ai +14/-21/786 (823; 719 enum constants' own
  overrides), kestra +27/-273/14 (37), playframework +5/-1/0 (21),
  SystemUI 0/-11/0 (2), spring-modulith +5/-3/4 (26), jextract
  +1/-9/6 (1); okhttp, nowinandroid, mihon, click, gin, serilog
  identical. The removed sites are guesses on library fields and
  methods (kestra's HttpStatus.X.getCode() x180).
- Cost (median of 3 interleaved): SystemUI CPU 92.0 -> 93.7 s, wall
  59.4 -> 58.6 s; Minestom CPU 46.7 -> 56.4 s, wall 17.5 -> 19.4 s, as
  its graph grows by the generated registries' 12,584 interface
  constants (29% more nodes, 30% more edges).

Reimplements #1949 by @mixxer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Issue #2979: FileLock.acquire() read the lock file, saw a dead PID,
unlinked the file and created its own with an exclusive create. Two
processes that read the same dead PID could both succeed: the first one
replaced the stale lock, then the second one, acting on what it had read
a moment earlier, unlinked the first one's live lock and created its own.
Both returned from acquire() and wrote to the index as its only writer.
The same steal happened in two narrower ways: a lock file read in the
instant between its exclusive create and the write of its PID was empty,
so it counted as stale, and a PID the process may not signal (EPERM:
another user's process, or an elevated one on Windows) counted as dead.

The fix keeps the lock file and its format (a bare PID) and changes how
it is taken:
- A free lock costs one create, as before. The lock file is created with
  its PID already in it: a private file hard-linked into place, which
  fails if the lock exists. Where hard links are missing it falls back
  to the exclusive create, and an empty lock younger than 10 s counts as
  held, since its creator is still writing its PID.
- A stale lock (dead PID, malformed, or empty and old) is replaced only
  by the process holding <lock>.break, itself a FileLock, after reading
  the lock again there, the way Mercurial breaks its locks. A break lock
  a crashed process left is broken the same way, one level up, at most
  three levels.
- EPERM from a signal-0 probe means the holder is alive.

Validation: __tests__/filelock-stale-takeover.test.ts runs two real
processes with a barrier: the slow one stops right after reading the
dead PID and resumes only once the other holds the lock. On main both
held it, 5 runs of 5; with the fix the slow one is refused and the lock
stays the holder's. The other cases cover the slow one getting in once
the lock is free, a live and a dead break lock, the empty-lock window,
EPERM (mocked, and for real on Windows with the System process), and no
leftover files.

Fixes #2979

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rts it governs

The resolver read tsconfig / jsconfig `paths` and `baseUrl` and go.mod's
module path once and kept the maps for its lifetime ("callers re-create the
resolver if config changes", which none did), and the watcher follows source
files only. So after an edit to one of them a long-running MCP server kept
resolving imports by the old mapping, and so did later processes: a sync
re-resolves only the changed files, and a config-only edit changes none.

The index now carries a snapshot of the config files resolution read: every
tsconfig / jsconfig the alias loaders opened, `extends` chains included,
every go.mod, and the root's candidates whether present or not. Every sync
reads them again and, when one differs, drops the resolver's alias and
module maps with the memos resolved through them, re-opens every import the
file governs (the ES-module family for a tsconfig / jsconfig, Go for a
go.mod) for the sweep, as a moved workspace map does, and marks synthesis
for a rebuild. An index an older engine stamped records a snapshot without
re-opening anything.

Review changes: each file's digest covers what resolution reads from it, a
go.mod's module path and a tsconfig / jsconfig's `extends`, `baseUrl` and
`paths`, not its bytes. A dependency bump in go.mod or a `strict` flag in
tsconfig had re-opened every import of the language for the same graph
(caddy: 48,945 refs, sync 3.8 s against 0.9 s; excalidraw: 88,860 refs,
9.2 s against 1.1 s). Plus a test for that, the ReferenceResolver class doc
comment back on its class, and the CHANGELOG entry beside the workspace-map
one.

Validation: 7 tests; on main's source the 5 behaviour tests fail, and the
new one fails on the byte digest. 11 fixture edits, each compared with a
fresh index of the same tree, in a later process and in the same process:
main diverged in 7 and 9, this in none. Real repos, sync against a fresh
index over nodes, edges, refs and files: excalidraw with `@excalidraw/math`
retargeted was 27 edges off on main and is identical here; caddy with its
module path renamed was 6,511 edges off and is identical here. Fresh indexes
are identical to main's. A one-file sync on excalidraw, median of 5
interleaved runs: main 3,834 ms, this 3,269 ms.

Original PR #2984 by @danusha2345.
Fixes #2977

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t (#3058)

Issue #2980: opening an index whose schema is behind read its version,
then ran each pending migration in a deferred transaction. When several
processes opened it at the same moment, those that read the version
just before another one migrated applied the same migration again, and
their open failed: on this Windows machine with "UNIQUE constraint
failed: schema_versions.version", since the version was already
recorded, and in the report with SQLITE_BUSY, which a deferred
transaction that has already read gets at once when it comes to write.

Each migration now runs in a transaction that takes the write lock up
front (BEGIN IMMEDIATE, a new option of the adapter's transaction()),
so a process that finds another one migrating waits it out on
busy_timeout, and reads the version again inside it, skipping a
migration already applied. The version the caller read stays a floor,
as before: a database built from schema.sql records only v1 and the
current version, and tests replay migrations above a version they
rewound to. An open of a current index takes no lock and waits for
nothing, as before.

Validation: __tests__/migration-concurrent-opens.test.ts. A second
process holds the write lock with version 16 recorded but uncommitted,
so the open reads 15: main fails with the UNIQUE error after waiting
1.1 s; the fix waits, opens and leaves the migration to the other
process. Three processes released at once from a stdin barrier on an
index with 150k unresolved references: main fails in round 0, the fix
opens all three in both rounds. On excalidraw's real index, 8 rounds of
three openers: main 7 rounds with failures, the fix 0. The single
process and the current-index cases pass on both.

Fixes #2980

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…orters

`c.ts` imports `foo` through `index.ts`, which re-exports it from `a.ts`.
Change the clause to `./b` and sync, and `bar` kept calling `a.ts:foo`
where a fresh index gives `b.ts:foo`. The barrel declares nothing of
`foo`, so the definition delta has nothing to rebind; no file was added
for the walks below a barrel or the added-files pass; the binding never
failed, so the retries never see it; and the name-matched-import pass
reads only bindings a name match took. `export *` moved the same way, and
a scoped sync of the barrel alone too.

The orchestrator now reports the modified ES modules whose `export … from`
statements changed, read off their import nodes (named by the module, with
the statement as signature) before and after the store. Their importers'
bindings through them go back for the sweep, up through the modules that
pass them on in turn, with the failures parked under them and the edges
into the members of what the bindings pointed at (`w.run()` with
`w: Widget`). It is the importer walk the removed-files pass uses, run
after the name-matched-import pass.

Review changes: the trigger compares the `export … from` statements
themselves. The original compared the modules a file imports and counted a
module that lost any import, so dropping a plain import from excalidraw's
`types.ts` (218 importers, no re-exports) re-opened 2,186 refs for the same
graph; it now re-opens none. Comparing statements also catches a name
dropped from a clause whose module stays (`export { foo, qux } from './a'`
to `export { foo } from './a'`), which the module set missed. Plus tests
for both, and the doc comments the new code sat between moved back.

Validation: 9 tests; on main's source 7 fail (the 2 controls pass), and
on the original trigger the 2 new ones fail. 15 fixture edits, each
compared with a fresh index, in a later process and in the same process:
main diverged in 8 of each, this in none. excalidraw with
`export * from "./utils"` in its math barrel (116 importers) retargeted to
`./constants`: main was 224 edges off, identical here over nodes, edges,
refs and files. Fresh indexes are identical to main's.

Original PR #2985 by @danusha2345.
Fixes #2978

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eanly (#3060)

Issue #2991: a host can stop reading an MCP stdio server's output while
it keeps the server's stdin open and stays alive. The next response the
server wrote then failed (EPIPE), and with no listener on stdout Node
handed the error to the last-resort fatal handler, which exits 1 at
once. That skipped the shutdown that stops the engine, releases the
writer lock and waits for query workers still starting, which on
Windows can crash a process that exits under them. Stdin, the host's
PID and the liveness watchdog all still look healthy, so nothing else
noticed.

A new treatStdoutFailureAsShutdown, the twin of the stdin teardown from
issue #799, routes a stdout 'error' (and the 'close' after it) into the
owner's own shutdown, at most once, destroys stdout so later writes are
dropped, and keeps its listener so a write queued before the failure
cannot escape during the shutdown. Backpressure is left alone. It is
wired into the direct-mode transport and into the local-handshake proxy,
whose shutdown closes only this session's daemon connection and stops
the engines it owns. The legacy socket proxy (runProxy) has had no
caller since PR #580 and is left as it is.

Validation: __tests__/mcp-stdout-failure.test.ts runs a real
direct-mode serve --mcp, and the local proxy with an in-process engine
and with a stand-in shared daemon. After the test destroys its end of
stdout and sends one more request, main exits 1 in all three, the
server with "Uncaught exception: Error: EPIPE"; with the fix all three
exit 0, the server's writer.pid is released, the proxy's engine stop
runs, and the daemon closes only the proxy's connection and still
answers its other client. __tests__/stdout-teardown.test.ts covers the
guard itself. proxy-shutdown, stdin-teardown and mcp-initialize pass.

Fixes #2991

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ename

x.go() with go in two classes stays unlinked while both exist. A sync that
deleted one of them, or renamed it away, never retried that call: the
failed-reference retry looks refs up by the names the changed files carry
now, which a deleted file or a renamed-away name no longer has, and a sync
that only deletes files skips the retry. Failed refs under the names a
sync's definitionDelta lost or gained now go back to pending for the
sweep, next to the CG-33 rebind that does the same for resolved edges,
under the same per-name ceiling. CODEGRAPH_NO_REBIND=1 turns both off.

Review changes: the CHANGELOG entry beside the sync entries for calls,
with credit.

Validation: 6 tests; on main's source the 4 delete and rename tests fail
and the 2 still-ambiguous controls pass. 10 fixture edits (Python,
TypeScript, JavaScript, Go, Java), each compared with a fresh index of the
same tree, in a later process and in the same process: main diverged in 6
of each, this in none. excalidraw with excalidraw-app/data/LocalData.ts
deleted (its `save` was one of two): main was 38 edges short of a fresh
index, identical here over nodes, edges, refs and files; renaming
BinaryHeap's `pop` away re-opens 28 refs that fail again, as in a fresh
index.

Original PR #3004 by @inth3shadows.
Fixes #3006

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A file over the source-size limit, or one whose parse failed, is tracked
with no nodes and its error recorded, so the imports of it fail. When an
edit lets it be indexed, sync stored it as a modified file, and only an
added file is looked up by what it can be imported as: an unchanged
importer's import of the file itself stayed failed, and so did what a
barrel passes on from it, until a full re-index. Named imports and calls
bound, since they wait by name.

A re-indexed file whose stored row had no nodes and recorded errors now
joins addedFilePaths once the store gives it nodes, so the added-file
retries and the importer and barrel walks run for it. It still counts as
modified. Deciding after the store leaves a file that changes but stays
over the limit, or still fails, alone, so it does not re-run those
retries on every sync.

Review changes: a test for the barrel shape, the one behind most of the
real-repo divergence below, and the CHANGELOG entry beside the one for
files saved with no symbols.

Validation: 5 tests; on main's source 4 fail and the stays-over-the-limit
control passes. 9 fixture edits, each compared with a fresh index of the
same tree, in a later process and in the same process: main diverged in 7
of each, this in 1, a barrel growing over the limit, where only the
edges' resolvedBy differs (same targets), as the PR noted. excalidraw with
packages/math/src/point.ts over the limit at index time and put back:
main was 1,506 edges short of a fresh index, identical here over nodes,
edges, refs and files.

Original PR #3022 by @inth3shadows.
Fixes #3016

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ext script

A self-closing `<script ... />`, such as Astro's
`<script is:inline set:html={code} />` or a third-party
`<script src="/analytics.js" />` in Svelte's `<svelte:head>`, matched the
extractors' script regex as an opening tag, so the match ran on to the next
`</script>`. The real script that followed was parsed with the markup in
between, failed with "parse produced no symbols", and contributed nothing.
The covered-range regexes had the same shape, so the template scans also
skipped the markup between the two tags, and a self-closing `<style />` hid
the markup after it.

The opening-tag pattern now matches a `/>` ending on its own as an empty
tag: in the Astro extractor's script blocks and covered ranges, the Svelte
extractor's script blocks and both of its covered-range scans, and the
viewer's highlight regions.

With a fix of ours: a self-closing tag has no body, so the covered-range
scans skip it, and a call in its attributes, like
`set:html={serializeJsonLd(schema)}`, is read as on main. Matched as a
range, such a tag hid those calls even where no script followed it.

Validation on main bc9291a (Windows 11):
- Red/green, 6 tests: 4 from the PRs, plus 2 of ours for an attribute call
  on a self-closing script in Astro and in Svelte. With main's
  astro-extractor.ts, svelte-extractor.ts and syntax-tokens.ts all 6 fail;
  with the PRs' code as written the 2 of ours fail; with this commit all 6
  pass.
- Svelte 5.56.10's own compiler reads the Svelte fixture as an empty head
  script plus an instance script, as the extractor now does.
- A/B against main on 7 Astro repos, with flask and express as controls.
  starlight, diploi.com and both controls are byte-identical, and
  devfest-website keeps every edge. Gains: the genkit docsite 2 import
  links, nodejsdesignpatterns.com 2 nodes and 2 import links, a portfolio
  25 component references, and wm-project-astro-components 3
  `serializeJsonLd` calls from JSON-LD scripts plus 1 call in a script main
  swallowed. That repo also drops 31 false calls, CSS like
  `border-radius: var(...)` that main read as calls after parsing a
  swallowed `<style>` block as TypeScript. No other edge changes.
- Index time unchanged: median of 3 interleaved runs on
  wm-project-astro-components, 4.67 s on main and 4.52 s with the fix.

Vue's extractor has the same pattern and the same bug; a follow-up shares
one pattern across the three extractors.

Original PRs #2995 and #2997 by @maxmilian.
Refs #2989

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ames the default (#3068)

statedDefaultExport reads a JS/TS file's own export default statement
by scanning comment-stripped source for line-initial `export default`
heads. Strings are deliberately not masked there (a masker that loses
step on nested templates blanked real statements), and a head counted
when it named a node of the file, the first such head winning. A code
generator's template text breaks that: in

  export function App() {}  export function Main() {}
  export const template = `
  export default App
  `;
  export default Main;

the template's line names the real App, so `import X from './gen'`
bound to App instead of Main (issue #2968). A template holding
`export default () => …` also made a module whose real default is an
expression read as anonymous, which keeps every guess away.

templateLiteralTextAt (strip-comments.ts) scans the source once for
template-literal text: it follows `${…}` nesting (a template inside an
interpolation, a brace inside a regex there), and skips comments,
quoted strings and regex literals, which may hold a backtick; a `/`
after a value divides, anywhere else it opens a regex. A head inside
template text is now skipped. When some template never closes the scan
vouches for nothing and every head counts, as before. Nothing else
changes: a head outside template text is read exactly as it was.

Validation: default-export-declaration.test.ts gains the issue's file,
a template returned by a function behind a nested template, one passed
at module scope and one in a class field, a template's anonymous
default above an expression default, and controls (a regex and a string
holding a backtick, a division after a parenthesis, and a file whose
scan can't close a template); strip-comments.test.ts tests the scan
directly. Red with main's resolver: 2 of 10 failed; green: all pass.
Checked against tree-sitter on every line-initial head of 4,191
JS/TS files in 16 corpora (outline, excalidraw, vben, bitwarden apps,
mastodon, shadcn docs, zod, bulletproof-react, express, astro, react,
trezor-suite, this repo's src, tests and ui): of 4,149 real export
default statements the scan puts none inside template text, and all
322 heads it does place there are template text. A/B on excalidraw
d3a9c2a1, vben 61c07936, astro e3bec3d2 (packages/astro/src and
packages/integrations), with gin-gonic/gin 0f09c3a9 and psf/requests
3c7baaa0 as controls, both arms on main 4b0f72b through the native
kernel (and again on 6644925 through wasm): all six byte-identical,
since no default import there is decided by template text; index time
unchanged.

Not in this change: hasEsmDefaultExport, which only gates
require('./x').default, still reads the raw text.

Reimplements PR #3042 by @johnhldiver-beep.

Fixes #2968

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ares it (#3064)

A Rust module loaded with `#[path = "…"]` was found by its file's directory:
fast-mlsirm's `#[path = "../../../tests/unit/scaling_tests.rs"] mod tests;`
in `crates/core/src/scaling.rs` made `tests/unit/scaling_tests.rs`'s
`use super::*` walk to a `tests/unit` module that doesn't exist, so its
`predict_rating_multi(1)` linked to nothing, or to a same-named function of
another crate; its `crate::` had no crate, and the parent's private items
looked out of its reach. From the declaring side, a path through such a
module (`utils::mock_event(…)` under `#[path = "./utils.rs"] mod utils;`)
reached nothing.

The fix reads each file's `#[path]` declarations as the Rust Reference
reads the attribute (from the declaring file's directory, or inside an
inline `mod` from that module's own; a path that leaves the project, by
escapesRoot, or that a `cfg_attr` sets, names no file):
- rustSubmodule: a module the module declares once with a `#[path]` is
  the file it names, whatever else loads that file too (a helper several
  tests load is each test's); cfg alternatives that name a file each stay
  unknown, and a path's 2015 crate-root fallback no longer reaches past
  such a module to a namesake at the crate root.
- rustPathClaim: a file the regular rules don't place is the module of the
  one `#[path]` declaration that loads it, if exactly one does. Placed
  (rustPlacedByName) are crate roots, files with a `fn main` or
  `#![no_main]` of their own (trybuild cases, fuzz targets), and files a
  plain `mod name;` declares in the module owning their directory or in an
  inline module of one above it (dioxus's `mod components { pub mod home; }`
  in main.rs). Only for a file left over are the project's Rust files that
  write `path =` read (a byte check first), once per resolver. With a
  claim, rustSuperModule is the declaring module, rustFileModule owns the
  file's directory (rustc reads every `#[path]` file as a mod.rs),
  rustCrateRootModule is the declaring file's crate, and rustModuleWithin,
  isRustItemVisibleFrom and isVisibleAcrossFiles see the file inside the
  declaring module, so `use super::*` brings in its private items.
- rustCrateGraph: `[[example]]`, `[[test]]` and `[[bench]]` paths are
  target roots, as `[lib]`/`[[bin]]` ones are since PR #3014, and such an
  example is its own crate's root (dioxus's
  `examples/07-fullstack/handling_errors.rs`).

Validation:
- rust-path-super-glob.test.ts (PR 1892's case, credited) and
  rust-path-attribute-modules.test.ts (7 cases): on main all 8 fail; all
  pass. Every rust-* suite passes.
- A/B against main, native kernel: fast-mlsirm (its Rust files) +2,796
  links (1,839 calls, 427 references, 334 constructions, 196 imports), 71
  retargeted (exposure_tests.rs's `Lcg::next_f64` from cdm_tests.rs's
  private `Lcg` to exposure.rs's, the declaring module's helpers instead
  of bifactor_grm.rs's), 87 reaching the same item through the declaring
  module (confidence 0.4 to 0.9), 0 removed; dioxus +27 (each headless
  test's `utils::mock_event(…)` into the helper five tests load); tokio +2
  (`use super::AtomicU64` in the files atomic_u64_as_mutex.rs loads);
  ripgrep, axum, clap, serde, gleam, express and flask unchanged.
- Cost, native kernel, medians of 3 interleaved runs: fast-mlsirm CPU 15.3
  -> 15.8 s, wall 4.2 -> 5.2 s, peak RSS 825 -> 882 MB; tokio CPU 26.1 ->
  26.7 s, wall 10.4 -> 11.2 s, peak RSS 1,023 -> 1,028 MB; dioxus CPU 34.8
  -> 35.6 s, wall 10.3 -> 11.2 s, peak RSS 1,125 -> 1,120 MB; gleam CPU
  24.1 -> 23.8 s, wall 6.6 -> 6.7 s, peak RSS 1,027 -> 1,023 MB.

Builds on PR #1892 by @seonghobae.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…of nothing (#3069)

Full-text search dropped the FTS5 syntax characters ( ) ^ " ' * : from a
query before quoting each word, so the words on either side of one were
glued together: leaf(entry) became the single prefix term "leafentry"*,
which no symbol has, and the LIKE and fuzzy fallbacks don't recover it.
codegraph query, the codegraph_search tool and searchNodes() all came
back empty for a pasted call like render(props).

The index's unicode61 tokenizer splits stored text at anything but
letters and digits (a signature's leaf(entry) is stored as leaf and
entry), so the query now splits there too: each of those characters
becomes a space, the treatment :: already gets (issue #173).

Validation: new search-special-characters.test.ts (8 tests) fails 8 of 8
on main and passes with the fix; fts5-fallback, search-field-filters,
search-query-parser, cli-query-command and symbol-lookup pass. A query
A/B on expressjs/express 0dee2c52, both arms over one index: 12 control
queries without such a character between words are byte-identical; 10
pasted calls changed, 7 of them from no results to results led by the
function they name (res.send(body), res.json(obj),
View.prototype.lookup(name)).

Reimplements PR #2987 by @kjgggggg.

Fixes #2971

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rops init -i (#3067)

The warning for a git worktree answered from another checkout's index
still said to run "codegraph init -i", a flag that has done nothing
since init started indexing by default. Its one-line form is prepended
to every read-tool result and codegraph_status embeds the long form, so
both told the agent to build the index, which the server instructions
rule out ("Indexing is the user's decision ... don't run it yourself").
The CLI's codegraph status now says: Run "codegraph init" in this
worktree. What an agent reads (the read-tool notice, which also reaches
it through the prompt hook and the explore/node CLI, and
codegraph_status) says the user can run "codegraph init" there.

Docs that no longer matched the code:
- AGENTS.md listed 4 of the 11 installer targets, called a new one "a
  5th agent", said the contract suite covers "all 4" targets, and listed
  11 of the 24 subcommands. It now lists every target and subcommand,
  and names the hidden ones (serve --mcp, prompt-hook, and ui/web unless
  CODEGRAPH_UI=1).
- README's Supported Agents section said no instructions file is
  written, but Claude Code, Codex CLI, Gemini CLI and opencode get the
  short CodeGraph section. Its Codex entry now says the Codex IDE
  extension reads the same config: $CODEX_HOME/config.toml (default
  ~/.codex/config.toml) for a global install, and .codex/config.toml,
  used only in a trusted project, for a local one.
- README's WSL2 "Transport closed" entry named only the in-process
  fallback. The daemon also moves its socket to the temp directory when
  the project's filesystem can't host one.
- init -i and -iv leftovers in internal docs, scripts, the add-lang
  skill and the repo's own Cursor rule, which now also leaves indexing
  to the user. Two stay on purpose: scripts/agent-eval/audit.sh can
  audit a published version older than 0.9.8, where init built the
  index only with -i (now commented there), and
  docs/benchmarks/codegraph-ab-matrix.md records a 0.9.4 run.

Validation:
- worktree-detection.test.ts: on main 6177692's worktree.ts and
  tools.ts, 4 of its 20 tests fail (the CLI wording, the agent wording,
  the read-tool notice and codegraph_status). With only the worktree.ts
  fix, the codegraph_status test still fails. All 20 pass here, and so
  do mcp-nested-repo-projectpath.test.ts's 13.
- Full suite on this patch over 6177692 (CODEGRAPH_KERNEL_EXPECT=1,
  4 workers): 815 files (809 passed, 6 skipped), 9608 tests passed,
  0 failed, 86 skipped.
- Rebased unchanged onto f67eafc. Its three new commits share only
  CHANGELOG.md with this PR, in other bullets. On the rebased tree these
  pass (81 tests): worktree-detection, mcp-nested-repo-projectpath, and
  the new commits' default-export-declaration,
  rust-path-attribute-modules, rust-path-super-glob,
  search-special-characters and strip-comments.

Reimplements #549 by @ashishpatel26, #651 by @GaoSSR, #885 and #886 by @Dashsoap, and #1083 by @zengwenliang416.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t (#3070)

The Vue extractor read a self-closing `<script src="./legacy.js" />` block
as an opening tag running on to the next `</script>`, as the Astro and
Svelte extractors did until PR #3063 (PRs #2995 and #2997) landed. The
`<script setup>` after it was parsed with whatever lay in between and
contributed nothing, and a `<template>` in between lost its calls and its
components too. One copy of the same pattern sat in each of 9 places in 5
files, and that fix reached the 6 copies in Astro, Svelte and the viewer.

sfc-script.ts, which the Vue, Svelte and Astro extractors already share,
now exports the script pattern and the script-or-style pattern, built from
@maxmilian's regexes, plus sfcBlockLineRanges, the line ranges a template
scan skips. A self-closing tag has no body, so it covers nothing and isn't
blanked, and calls in its attributes are read. All 9 sites use them: each
extractor's script blocks, Astro's covered ranges, both Svelte template
scans, Vue's template-components scan, the Vue template-calls blanking
and the viewer's highlight regions. The pair also accepts a closing tag
written with a space, `</script >`, as the template-calls blanking always
did; the viewer finds a block's body from its opening tag for that reason.

Validation on main 6177692 (Windows 11):
- Red/green: 4 Vue tests (a `<script src ... />` block before
  `<script setup>`, one before `<template>`, an attribute call on a
  self-closing script in the template, and `</script >`) fail with the
  previous sources and pass; the 6 Astro and Svelte tests still pass.
- A/B: 5 Vue repos (vuejs/core, vuejs/docs, NekoBox, justgage,
  element-plus-playground; none has a self-closing script) are
  byte-identical to main. 7 Astro repos, 2 Svelte subtrees (shadcn-svelte
  docs routes, SvelteKit's basics test app) and the flask and express
  controls are byte-identical to the Astro and Svelte fix before this one.

Fixes #2989

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…params, not a crash (#3071)

A tools/call request passes its arguments as an object. MCPSession took
params.arguments || {} without checking that, so a string or number went
straight to the tool handler, where the session-view check
('_cgExploreSession' in args) threw. The call then came back as a tool
result flagged isError: "This is an internal codegraph error, retry the
call once; if it persists, continue without codegraph". That reports a
client's malformed request as codegraph's own malfunction, with advice to
stop using it. An array went through as if it were the arguments. The
stdio proxy, serving in process while the daemon is unavailable, had the
same unchecked read.

Both now read the arguments through one helper, toolCallArguments(), and
answer anything but an object with a JSON-RPC invalid-params error
(-32602, "Tool arguments must be an object"), as a call with no tool
name already is; no tool runs, and the proxy starts no engine for it.
Missing, null or another empty value still means no arguments.

Validation: new mcp-tool-call-arguments.test.ts covers the session (the
direct stdio server and every daemon client) and the real proxy entry
point in a child process with the daemon unavailable: red on main (2 of
3 failed; the well-formed control passed), green with the fix.
explore-session-state and proxy-shutdown pass. Driving serve --mcp over
stdio: on main, codegraph_explore, codegraph_node and codegraph_search
with a string argument returned isError "internal codegraph error" and
codegraph_status accepted [1], 42 and true; with the fix those six get
-32602, while "", null, {} and absent arguments run as before.

Reimplements PR #2986 by @kjgggggg.

Fixes #2981

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… types (#3065)

Four Delphi bugs that PR 2550 by @OleksiyPenkov found, reimplemented on
main's Pascal scope code rather than as a second resolver:

- A call through a chain of members and methods recorded only the outer
  method's bare name, which name matching gave to any namesake: SynEdit's
  Canvas.Font.Assign(Font) went to TProposalColumn::Assign, and
  TLogger2.Create.Write('y') linked nothing, a bare Write being a System
  name. The extractor now writes such a call as the typed chain
  pascal-scope already resolves for paren-less names ({call} for a
  statement, a new {args} mode for a last link written with its
  arguments). Each link is typed by its declaration: field and property
  types, function results, a local's declared type, through pointer and
  class reference types (PVirtualNode = ^TVirtualNode, TSynLogClass =
  class of TSynLog) and explicit dereferences (a^.Copy). A constructor
  called on a class gives an instance of it, a unit name, dotted ones
  too, qualifies its declarations, and a chain called with arguments may
  end at data that holds a routine. There is no bare fallback: a chain
  through a type from outside the project links nothing, and in a with
  body only a chain from Self or a typed local is read.
- A method given to a target was a method pointer only when the target
  was named On.../FOn...: Callback := FProvider.Value with Callback: TGet
  recorded a call, and FOnGet := @FProvider.Value nothing. A value given
  to an assignment now carries its target, whose declared type decides
  (routine types written out, of object, reference to, project aliases,
  the RTL's routine type names; a class, a record or a System value type
  holds no routine); the name decides only where the declaration can't
  be read. A function that returns a routine type is called for it, and
  @Obj.Method is a reference anywhere.
- A nested routine's locals leaked into the routine around it: the name
  matcher's Pascal receiver scan read every declaration above the call.
  It now steps over routines nested elsewhere, reads the calling
  routine's own name lists (Doc, Doc2: TDocVariantData), which main typed
  only by luck through a nested routine's parameter, and follows pointer
  and class reference types. Where the tree has errors, the source-text
  scopes give the outer routine its own names back after a nested one.
- A nested routine declared forward is in scope from that declaration.

Validation:
- New __tests__/pascal-reference-boundaries.test.ts, 41 tests, 24 of
  them ported from PR 2550: 22 fail on main's sources, the other 19 pin
  what main already got right. pascal-chained-calls and pascal-for-in-var
  pinned the bare outer-method names and now expect the typed chains
  (4 tests, failing on main). Twenty mutations, one per rule, each fail
  a test.
- A/B against main 80f6b50, both arms built from their own sources and
  diffed by natural keys, edges removed/added: SynEdit 195/66, HeidiSQL
  789/320, mORMot2 2553/4164, DelphiMVCFramework 2394/1850, DWScript
  without its Test folder of scripts (519 files) 864/801. leveldb and
  SDWebImage byte-identical.
- Removed edges, hand-triaged: SynEdit all 195, 193 namesakes or parse
  artifacts and 2 right ones lost (Get(i).LoadFromStream in a with
  body); samples of HeidiSQL 20/20, DelphiMVCFramework 30/30, DWScript
  12/12 and mORMot2 23/25 namesakes (of the other two, one now links the
  unit's own CompareMem, and one right edge is lost, through a field
  declared after the first name of a name list, which the extractor
  gives no node).
- Added edges sampled right: typed chains 186 of 187 (the wrong one
  reaches the FMX variant of a conditional ancestor), receiver calls
  40/40, method pointers, @-references and kind changes 57/57.
- CPU, median of 3 interleaved: SynEdit +6.6%, HeidiSQL +0.6%, mORMot2
  -2.5%, DWScript +4.7%, while the identical controls moved 0.0% and
  -5.9%. DelphiMVCFramework, timed before the scan's memo was split per
  routine (which only made it cheaper): -6.6%.

Reimplements part of PR 2550 by @OleksiyPenkov.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot and others added 29 commits November 20, 2026 15:04
[skip ci] Auto-generated by Release workflow.
…64) (#3466)

The extensionless Windows launcher passed node.exe the POSIX path `pwd`
gives (/c/Users/...). Git Bash rewrites such an argument for a native
program only while path conversion is on; a terminal with
MSYS_NO_PATHCONV=1 or MSYS2_ARG_CONV_EXCL=*, which some agent harnesses
export, passed it as is, Node read it as C:\c\Users\..., and every
`codegraph` call failed with MODULE_NOT_FOUND. The launcher now converts
the script's path with `cygpath -w`, as npm's own shims do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… tool on small repos (#3463)

The small-repo gate in ToolHandler.getTools() ran after the allowlist, so on a
project under 500 files tools named in CODEGRAPH_MCP_TOOLS (callers, callees,
impact, ...) were dropped from tools/list while still being callable. The gate
now trims only the default surface; an explicit allowlist always wins. The
default surface is unchanged.

Fixes #3462

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ever cuts them for tests (#3432)

`codegraph callers` and codegraph_callers listed callers in edge order, which
follows hashed node ids, so for a symbol called mostly from tests the
default limit could show only tests while the callers that run in
production sat past the cut. Callers outside tests now come first, each
half in its own order, and the CLI and the MCP tool share one reading of
what a test is. Totals, limits and the truncation marker are unchanged.

Fixes #3456

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…th offset (#3449) (#3450)

codegraph_callers and codegraph_callees capped their list at limit (at most
100) with no way to read past it. Both now take offset, the number of
entries to skip. A cut first page names the offset of the next one, a later
page says which slice it shows, an offset past the end says so, and with
several definitions each section is paged by the same offset. A fractional
limit is floored. Without offset the list is as before.

Closes #3449

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…as the type the chain returns (#3447) (#3454)

`sub := new(Route).Host("x").Subrouter()` typed `sub` as `Route`: the scope
index read a `:=` local's type from the start of its value, `new(T)` or
`T{`, whatever came after it, and that type won before the value was read
as a call. `sub.Path("/a")` then reached `Route`'s `Path`, not `Router`'s.

The scope index now types a local this way only when no selector follows
the `new(T)` or the literal's closing brace. A chain from a builtin's call
counts as a call's value, and is read by the chain reading that already
types `new(T)`, `make(T)` and composite-literal heads, so the local gets
what the last call returns. `x := new(T)`, `x := &T{…}` and `x := T{…}`
are typed as before. gorilla/mux: the 10 calls in TestSubRouter move from
Route.Path to Router.Path, and no other edge changes.

Fixes #3447

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…459)

A newline after a selector `.` does not end a Go statement: Go inserts no
semicolon there. A local's value is now read on past a line that ends at a
`.` when its type is inferred, in a `:=`, a `var` and an `if` header, so a
call on a local given a chain broken after its `.`s, the way gofmt leaves a
long chain, links to the method of the type the chain returns.

Fixes #3455

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iteral has the type it returns (#3455) (#3467)

With #3459 a local's value is read on past a line that ends at a `.`, so a
broken chain from a function call, a local or `(&T{})` is typed by what it
returns. One that starts with `new(T)` or a struct literal still kept the
type its head writes: #3454 left that type in place when the chain broke
after the `.`, because the value used to stop there. The scope index now
treats a `.` at a line's end like one on the same line, and the value
reading types the chain (`newBroken`, `literalBroken`,
`literalFieldsBroken` in the issue's table).

`go-chain-head-locals.test.ts` pinned the old broken-chain types; its
broken shapes now get the type the chain returns. The issue's 18-function
fixture is a test of its own, every row as the issue expects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (#3458)

Pascal methods and free routines declared in the interface or with
`forward` now take their source range from their implementation, so
`node` and `explore` return the body, not the declaration. The node keeps
its id, documentation, visibility and signature. An implementation finds
its declaration by scoped name, generic arity and parameter types, so
overloads keep their own bodies.

Fixes #3453

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mentations find their declarations (#3453) (#3468)

Completes #3453 on top of #3458, which locates a Pascal routine at its
implementation.

A call that reached a routine now reaches an overload its argument count
fits, when the reached one doesn't fit: the name strategies weigh
candidates by where they are, and an overload implemented nearer the call
had won. The count is read after the call's own name, not a receiver
named like it.

An implementation finds its declaration by parameter and result types;
of identical declarations in both {$IFDEF} branches, the first not yet
implemented; else the one whose parameter types agree in at least half
the positions (Longint and Integer count as alike). A second
implementation under {$IFDEF} joins the first one's range when only
directives and comments stand between them. A parse error that ran into a
routine's header no longer starts it at the routine above, and a class
the grammar folded into a broken subrange or set type is named from its
own `Name =`.

A Pascal call written through a receiver ranks the candidates other than
the calling routine, now the nearest one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lass (#3410) (#3469)

A Kotlin class header can hold code: a constructor parameter's default
value, a superclass constructor's arguments, a `by` delegate
(`class BaseActivity : AppCompatActivity(), SecureActivityDelegate by
SecureActivityDelegateImpl() {`). A bodiless class walked its whole header
as its body; a class with a body walked only the body, so on both engines
those calls linked nowhere. tree-sitter-kotlin 0.3.8 read `I by X() {` as
a bodiless class whose body was X's trailing lambda, which linked X() by
accident; #3419's grammar reads the body, and the links went away.

A new optional LanguageExtractor hook, classHeaderCode, lists a header's
code in source order (Kotlin: each class_parameter default, each
constructor_invocation's value_arguments, each explicit_delegation's
delegate). extractClass (when the class has a body) and extractEnum walk
it with the class on the stack, through the same dispatcher a bodiless
header uses. The kernel mirrors it (kotlin.rs class_header_code).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…n WAL whenever it starts (#3472)

A pool started mid-run on a fresh index ran with the database still in
fast-init's in-memory rollback journal, so the workers' reads and the
writer's commits blocked each other; only an up-front start (150,000 refs
or more) switched to WAL first. ktor, at 142,215 refs since the Kotlin
grammar upgrade, paid that plus two sequential batches before its pool
was ready.

- ResolverPool.tryCreate takes a hook it runs once the pool is going to
  start, before any worker opens the database. indexAll's fast-init WAL
  switch moves into it, so every pool start gets WAL and a run that starts
  none keeps the fast journal.
- poolStartBeforeFirstBatch: a full index with two thirds of the gate
  (100,000 refs) starts the pool before its first batch without waiting
  for it, and takes the bulk index windows an up-front start takes.
  Syncs are unchanged.

codegraph init, median of 4 interleaved rounds on Windows 11: ktor
16.69 -> 14.53 s (main with the gate at 140k: 14.41 s), Exposed
14.20 -> 12.96 s, kotlinx.coroutines 8.68 -> 8.37 s, detekt
8.87 -> 8.60 s; koin and nowinandroid start no pool and are unchanged,
and so is a sync. Graphs byte-identical on all six repos.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ubject's member first (#3471)

A bare Pascal call that no scope of the call declares (a `with` subject, the
calling routine, its class, its unit, the units it uses) no longer links a
same-named routine elsewhere in the project. HeidiSQL's `Max(a, b)` from
System.Math reached SynEditMiscProcs.Max, and DWScript's DUnit `Check(...)` a
test script's `TBase.Check`. #3458 unmasked these when nested routines
stopped absorbing such calls.

In a `with` body a bare call is first a member of the subject's type, the
innermost subject first. A scanner finds each `with` statement's subjects and
body span per file. A subject is typed from Self, Result, locals, members of
the class, the unit or an enclosing subject, constructors, casts, member
chains and indexing. A subject whose type the project doesn't declare whole
stops the walk.

The scope model also covers a helper's methods (the helped type's members),
routines nested in code the graph gives to the file, and units an include
file in a `uses` clause lists. It leaves include files no unit includes alone.

Five-repo A/B against main: 4,685 calls removed, 280 re-targeted to a `with`
subject's member, 39 added; triaged by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rtypes resolve to the type the file can see (#3474)

`class CachedRepo(inner: Repo) : Repo by inner` gave the class no edge to
Repo on either engine: the delegation_specifier's only child is an
explicit_delegation, and the supertype reading looked for a direct user_type
or constructor_invocation. Both engines now take the explicit_delegation's
user_type, as object expressions already did; the resolver promotes it to
`implements` against an interface. A call through the interface then reaches
the overrides of a class that delegates the rest.

Delegating a standard-library interface (`List<T> by list`) resolved `List`
to a project's nested `object List`. isKotlinSupertypeVisible holds a bare
Kotlin supertype name to Kotlin's lookup (own file and package, an import, a
star import, the default imports; a nested type inside its owner or a
subtype, or imported), as isJavaTypeVisible does for Java: a filter ahead of
exact-match ranking, a veto on fuzzy's single guess.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…475)

Delphi class and record helpers (`TFooHelper = class helper for TFoo`) were
indexed as type aliases, their methods not at all: the grammar's declHelper
fell to the alias fallback, so their bodies' code belonged to the file,
`node` and `explore` couldn't show the methods, and nothing linked to them.

Extraction: a declHelper is a class whose signature is its head as written
(`class helper for TFoo`). Its members are visited as a class's, so its
methods are method nodes at their bodies. It extends the helper it
descends from and references the type it helps.

Resolution, as Delphi does it:
- A helper's methods reach its members, its parent helper's, then the
  helped type's.
- A value reaches the nearest helper in scope for its type (its unit's,
  else the unit used last), whose methods hide the type's own, level by
  level up the hierarchy.
- A call through a receiver to a name some helper declares is settled by
  the receiver's type, with the overload taking its argument count exactly.
- A helper's method is callable only where the helper is in scope.
- A helper helps only a class its unit can see.
This replaces #3471's helpedType stopgap.

Five-repo A/B against main (8763586): 79 helpers become classes with 317
methods, 367 calls move from the file to helper methods, 1,002 calls are
added, 194 re-targeted and 115 removed; triaged by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s overloads and exports (#3476)

#3471 dropped a bare Pascal call whose name no scope declares. A call
the scope did declare kept whatever namesake the name strategies chose,
and those lean on where candidates are: a same-named method in the
calling file won over the routine the call means (6,608 of mORMot2's
`Check(…)` calls in TSynTestCase descendants reached TUriMatch.Check).

gatePascalCall now re-targets an in-scope bare call to what the scope
declares first: a nested routine, the calling class's member, the
unit's own declaration, then the used units', the last first. A
routine, or data holding one, is linked; a type is a typecast and other
data no call; a parameter or local of the calling routine comes before
all of them.

- Routines of one name in several units the code sees are one overload
  set (mORMot's FormatUtf8 in mormot.core.text and mormot.core.json):
  the strategy's choice stands while the arguments fit it, else the one
  taking them exactly.
- Other units see only the routines a unit's interface declares. The
  section scan reads code only (a comment line in MVCFramework.pas
  starts with "implementation"), takes each {$ifdef} branch on its own
  (mORMot's do-nothing-on-POSIX units open the implementation in one
  branch), reads a routine's name past a directive in its header
  (`{$ifdef OSLINUXANDROID} function {$endif} CpuThreads`) and reads
  include files the interface pulls in.
- Two declarations of one name in one unit are {$ifdef} alternatives
  (mORMot's MoveFast, a variable or the asm routine asmx64.inc
  implements; ToByte, a type or an inline function): the routine, with
  a body to read, is the one linked, as on main.
- A routine and its body in an include file of its unit are one
  routine, so the strategy's choice between them stands.

Every-edge A/B vs main on SynEdit, HeidiSQL, DelphiMVCFramework,
mORMot2 and DWScript: 12,633 calls re-targeted, 12 removed, none added,
no node changes; triaged by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Pascal `inherited` call left no reference: the extractor dropped
`inherited Run(N)` and a bare `inherited;`, so a method's call into the
implementation it overrides was missing, and flows through overrides
stopped there.

- Extraction records every `inherited` form as a calls ref
  `{inherited@Class}.Name`, a bare one as `{inherited/N@Class}.Name` with
  the routine's own name and parameter count; nothing outside a method,
  nor for an assignment target.
- pascal-scope resolves it alone: along the calling class's base chain
  (the first declared supertype, as the class's unit sees it; a helper's
  parent helpers, then the type it helps), the nearest class declaring
  the name decides. Data links nothing; of its routines, the overload the
  arguments fit (a bare call's own parameter types first), else on up
  the overload set; never a class constructor or destructor; nothing
  outside the project.

A/B against main (f4c37e4), every edge: SynEdit +240, HeidiSQL +493,
DelphiMVCFramework +386, mORMot2 +1,090, DWScript +1,000 calls; nothing
removed or re-targeted, no node changes; triaged by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… at its own end (#3478)

In mORMot2's mormot.core.interfaces.pas, TInterfacedObjectFakeRaw.FakeCallGetParamsFromStack holds

  {$ifdef ABIX86} case a^.RegisterIdent of ... else
  {$else} {$ifdef HAS_FPREG} ... {$endif} ... if V = nil then begin
  {$endif ABIX86} ... end;

Each branch opens one block for the same `end`. The grammar reads every branch, so together they
open one block too many: the routine's body never closed, its node ran from line 3446 to 6586, the
111 routines after it had no nodes, and their calls (LockedFind, TInterfaceResolverList.TryResolve's
body) were its own.

The pre-parse already blanked a second `begin` when every branch opened one, but skipped this group
twice over: one branch opens a `case`, and a branch holds conditionals of its own. Now:

- One branch may keep a `case` or a `try` (mORMot's `{$ifdef HASFASTTRYFINALLY} try {$else} begin
  {$endif}`) while the `begin`s of the others are blanked.
- A branch may hold conditionals of its own; they read as the pass left them, so a nested group
  whose second `begin` it blanked counts one block, not two.
- Once the bodies are settled, a conditional the pass resolved that the blanking left right after a
  routine header (nested at the start of a body, or after an assembler branch blanked whole) loses
  its directives too: the grammar reads a conditional there as alternative bodies, which its
  branches aren't (DWScript's dwsSHA512 `BSwap64`, dwsXXHash `DigestTail`).

Across SynEdit, HeidiSQL, DelphiMVCFramework, mORMot2 and DWScript, two routines swallowed later
routines on main (mORMot2's, 111 headers; DWScript's `InterlockedIncrement`, 24); none do now.

A/B against main (b9285eb), every edge: SynEdit, HeidiSQL and DelphiMVCFramework unchanged.
mORMot2: 35 nodes recovered, 371 calls moved to the routine they are in, 104 headers no longer
read as calls, 28 new links, 17 calls picking another same-arity overload or receiver method.
DWScript: 13 calls moved, 1 header, 6 new links, 2 calls to the nested BSwap32. Triaged by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pe it is handed (#3497)

* fix(rust): a call on a closure's parameter links the method of the type it is handed

A method called on a closure's parameter was left unlinked whenever two types
in the project had a method of that name, because the parameter's type is not
written beside it. So in

    rpc.as_mut().is_none_or(|r| r.stop().is_ok())

the call to `Rpc::stop` was missing from `callers` and `impact` as soon as a
`Control::stop` existed, and a change to `Rpc::stop` looked like it reached
nothing there.

The parameter's type is now read from the call the closure is handed to: the
item of the receiver for `map`, `for_each`, `filter`, `is_some_and`,
`is_none_or`, `and_then`, `inspect` and the like, and the error side for
`map_err`, `or_else`, `unwrap_or_else`, `is_err_and`, `inspect_err` and the
first closure of `map_or_else`. A tuple pattern (`|(a, b)|`) reads its field.
`as_mut`, `as_ref`, `as_deref`, `take`, `cloned` and `copied` on an `Option` or
`Result` keep the wrapped type, which also links what
`if let Some(x) = value.as_mut()` binds.

A closure with more than one parameter, and one handed to a method this does
not know, link nothing, as before.

Tests: `__tests__/rust-element-binding-receiver.test.ts`, 8 cases, each with
three types that share the method's name, so a pass means the receiver's type
was read. Full suite on macOS: 983 files, 12,116 tests pass.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* docs(changelog): reference the pull request

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
A source file over the size limit is tracked and never parsed, so the graph
holds none of its symbols. That is on purpose. What was wrong is that nothing
said so: `index` printed "Indexed 1,678 files", `status` printed "Index is
up to date" with no parse errors, and the file's own symbol map read "No
indexed symbols in this file", for src/resolution/name-matcher.ts in this
repository, 37,000 lines of hand-written source at 1.9 MB. A search, a caller
list or an impact report over such a project is missing whatever the file
holds, and silence reads as "not there".

- `getIndexHealth()` lists the files left out for size, with their sizes.
- `status` names them and reports them in its JSON as
  `index.filesOverSizeLimit`, `index.oversizeFiles` and
  `index.sizeLimitBytes`. It still says the index is up to date, and
  `--strict` still passes: nothing is stale, and a sync would change nothing.
- `init`, `index` and `sync` print the same line when a file is left out.
- `codegraph node --file <path> --symbols-only` says the file was not
  indexed and why, in place of an empty map.

The smallest are named first: a generated parser of 30 MB is what the limit
is for, and a file just over it is the likeliest to be written by hand. In
this repository that puts name-matcher.ts ahead of four generated parser.c
files of 7 to 35 MB.

The limit itself is unchanged.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…x files up to 4 MB (#3504)

* perf(index): a large file indexes in the time its size asks for; index files up to 4 MB

A large source file took time in the square of its size. A Python file of
plain functions took 3 seconds at a third of a megabyte and 27 at nine
tenths, a Ruby one twice that; a table of rows that each call a helper took
37 seconds at a third of a megabyte; one string of hex 30 KB long cost a
second, which is eighteen minutes for a megabyte of it. Past about a megabyte
a file was given the 180 seconds a file is allowed and then given up on, with
none of its symbols indexed. That is why the size limit could not be raised.

Every cause was the same shape: work done for each symbol, or each reference,
that went through the whole file or everything before it.

In both extractors (the native kernel and the wasm one):
- A declaration's decorators were looked for after finding where it stands
  among its parent's children, counted from the first (seven languages). The
  walk now starts from the declaration.
- A Ruby method's visibility walked back over every sibling before it; a C++
  member read every child of its parent. Each now keeps what the last answer
  was, per parent.
- A node's children were read by index, and tree-sitter reads the children
  before the one asked for when they are a flat run, as some thousand
  consecutive comment lines are. They are now stepped through (278 loops in
  the kernel; in the wasm extractor, the 97 that read every child).
- Each JS/TS constant compiled a pattern and searched the whole file to see
  if a later statement exports it. The names are read once per file.

In the kernel alone:
- A column was counted character by character from its line's start, so a
  script minified to one line paid its length for every symbol. It is read
  from a table built once per file.
- The C scan searched for `struct` and for `union` from its place on every
  turn, to the end of the file for whichever the file does not use.
- A declaration's walked initializers were kept as a list and searched for
  every node under it: a Go `const (…)` block of some thousand names.

In the resolver:
- "Does the function's code, from its first line through this one, bind this
  name?" read that code again for each line asked about (JS/TS, Scala), and
  a Python reference read its whole statement, which for a table is the
  whole file. Each is now read once and answered for any line.
- What is around a reference (its function, its class, its namespace) was
  found by going through every node of the file, in nearly forty places. The
  nodes that can hold a line now come from a per-file index
  (nodes-around.ts); the test each place makes is unchanged.
- A file's imports were gone through for every reference at each step of
  import resolution. They are indexed by name and by source
  (import-lookup.ts).
- Import statements named alike (`crate` for every `use crate::…` of a Rust
  project) went through each other; a file's nodes were filtered by name, or
  queried one name at a time, for every reference.
- The line of an offset was written `text.slice(0, i).split('\n').length` in
  more than fifty places, a pass over the file for each match of a route or
  handler scan.
  They share one helper (lineAt).
- A few checks stripped or split their whole file for each reference
  (object-literal aliases, store calls).

One change is a change of what is read, not only of how fast: the resolver's
patterns are no longer given a run of name characters longer than 1,024 (an
embedded asset, a key, a table of hex). A pattern that reads a name starts
one at every character of such a run and reads to its end. The run is
blanked, at its length, in the text the resolver reads (withoutLongRuns);
the file on disk, its symbols and its positions are untouched.

With that, the limit goes from 1 MB to 4 MB. At 4 MB a file of some hundred
thousand imports or references also overflowed the stack where a list was
spread into a call's arguments; those lists are now added item by item.

Checked against the engine as it was: the graph built from this repository's
test fixtures, from its own source, from the desktop app, from parts of the
Python, Ruby and Go standard libraries and five Rust crates, and from 300
generated files (one a language and shape) is the same, node for node and
edge for edge, with the kernel and with the wasm extractor.

At 3.9 MB, 317 generated files (17 languages, 24 shapes) index in 2.2 seconds
on average, the slowest in 12 (130,000 `#include` lines). Fourteen real files
of 1 to 3.8 MB found on one machine (generated Go, tree-sitter parsers, Arm
headers, a bundle, icon typings, this repository's own name-matcher.ts) take
0.3 to 4.2 seconds each.

Memory per megabyte is as it was, so a file four times the old limit can take
four times the memory while it is indexed: 0.15 to 0.7 GB at its peak for
those real files, 1.8 GB for the 3.8 MB bundle.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* perf(index): large files in the other languages, in routes files and across the bridges

The commit before this one measured the seventeen languages the native
kernel reads. The README lists about twice that many, and the frameworks
whose routes and handlers are linked; none of those had been timed. Timed
now, at 1.2 MB: an Express file of inline handlers took 58 seconds, Liquid
markup 41, a CodeIgniter routes file and its controller 31, ArkTS components
22, a React Native Fabric spec 20, a file of event listeners 16, and a
Rails, Play, React Router or Angular routes file 8 to 12.

The causes were the same shape as before, work for each symbol, reference or
route that goes through the whole file, in the places that commit did not
reach:

In the wasm extractor and the extractors that read without a grammar:
- An ArkTS declaration's decorators were looked for after finding where it
  stands among its parent's children, counted from the first.
- Liquid read the text before each tag for its line, and split the whole
  source for each line's start. Both come from a table built once.
- A member's qualified name looked for each id on the stack among every node
  extracted so far (five places). They are kept by id.
- A Vue options component looked for the member around each reference among
  all of them. The member of each line is written down once.
- The ninety loops over a node's children that leave early were still read
  by index (the first commit converted those that read every child). They
  step with a cursor (childrenOf, namedChildrenOf): a megabyte of comment
  lines under a VB.NET module took four seconds.

In the resolver and the framework passes:
- "The node of this file named X" was a pass over all of the file's nodes,
  once per route for a routes file and its controller (CodeIgniter, Rails,
  Play, Laravel, Drupal, Vue, Angular, React) and once per reference in a
  dozen other places. The nodes of a file are indexed by name, by name in
  any case, and by owner (nodesNamed, nodesNamedLower, nodesUnder).
- React Router looked for the routes around each route among all of them,
  and for a page claiming the same path among all of them. Routes are kept
  by stretch of the source and by path.
- The scan for the line that declares a receiver's type keeps its last
  answer and goes on from it when asked about a later line; asked about an
  earlier one, it scanned again from that line up. It now answers from what
  it kept. That was the Express file: each handler calls a method on a
  parameter nothing declares.
- Event listeners, Angular templates and the enclosing-function helpers
  went through every node of the file for the ones around a line; the line
  of an offset was counted from the file's start for each Angular binding
  and each React Native bridge method.
- A JSX file of many components searched the whole scope for each tag name
  written bare. The words are read once.
- A React Native Fabric spec looked for each prop's name from the first
  line of its props interface, and for the interface itself each time:
  twenty seconds for an interface of 1.2 MB. Where each name first occurs is
  read in one pass (firstIndexOfEach).
- An Objective-C message that a Swift `@objc` method might answer split the
  Swift file into lines, to read the three above the method's declaration:
  seven seconds for 0.8 MB. The file's lines are split once.
- A member called on a module's default import asked whether the module's
  file says `module.exports`, then read the file for what it states as its
  default, for each call: four seconds for a megabyte of calls on one
  TurboModule. Each is asked once per file.
- A Tauri front end tried a pattern on the code before each `invoke` call to
  see whether the function destructures a binding of that name. Where the
  first such binding ends is kept per function.

Nothing here changes what is read. The graph is the same as the engine at
main builds, node for node and edge for edge, over the bodies of code the
first commit was checked on, over 96 more generated projects, one for each
remaining language, framework and bridge, and over small projects written
for what the faster paths decide, with the kernel and with the wasm
extractor.

One slowness is left, and it is the parser's: tree-sitter's Objective-C
grammar does not parse `RCT_EXTERN_METHOD(...)` lines inside an
`@interface`, and its error recovery takes the square of their number. Two
thousand such lines take half a second and sixteen thousand seven; thirty-two
thousand are given up on at the parse limit, with the timeout reported. A
real shim has tens of them. Blanking the lines before the parse would change
what the parser makes of every such shim today, which this commit does not
do.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* docs(index): what made large files slow, how to measure it, how to keep it out

The two commits before this one removed about forty instances of one fault,
and nothing in the repository said what the fault is, what to write instead,
or how it was found. The next change to an extraction or resolution loop
would have put it back, and the next report of a slow file, or of one with
no symbols, would have started from nothing.

- docs/design/large-file-performance.md: the rule (a file costs its size),
  the shape of the fault with each form it took and what to write instead,
  the rules for a lookup that keeps an index, how to measure, how to find
  the line, how to prove the graph unchanged, the traps that cost a run,
  what is known and left as it is, and what to do with an issue or a pull
  request.
- AGENTS.md: the rule and the pointer, in the guide every session loads.
- scripts/benchmarks/large-files/: the two harnesses the numbers came from
  (the kernel's 17 languages in about 24 shapes; the other languages, each
  framework's routes file and each bridge), a profiler that names the line,
  and compare-graphs.mjs, which indexes a project with two builds and
  compares what scripts/dump-graph.mjs prints for each.
- CONTRIBUTING.md and docs/README.md point at the guide.
- CHANGELOG.md: this pull request's entries without timings, as the rules
  for entries ask.

compare-graphs.mjs uses the repository's own dump, which also holds the
unresolved references. Run over what the earlier commits were checked on
(the fixtures, this repository's src, real code in five languages, the
generated projects and the small ones written for each decision, 117
projects in all), it finds every graph the same, with the kernel and with
the wasm extractor.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…xpands to (#3506)

A Swift module reaches JavaScript through an Objective-C file that is all
macros: `@interface RCT_EXTERN_MODULE(Name, Super)`, a line of
`RCT_EXTERN_METHOD(…)` for each method, sometimes lines of
`RCT_EXPORT_VIEW_PROPERTY(…)`, and a method or two with bodies. The grammar
parses none of it. It read an interface named for the macro and recovered
from every line under it.

What that gave, on 21 shims of six published libraries and on written ones:
- a class named `RCT_EXTERN_MODULE` or `RCT_EXTERN_REMAP_MODULE`, and for 11
  of the 21 no class at all;
- a method written after the macros as a function on the first macro's line,
  or not at all, and nothing its body calls;
- time in the square of the macro lines, inside the parser: 2,000 lines took
  half a second, 16,000 took seven, and 32,000 ran out the parse budget
  twice (40 seconds) and left the file with nothing.

The macro expands to an interface for `Name`, closed at once, and then
`@implementation Name (RCTExternModule)`: what follows is an implementation's
body. The parser is now given that, at the same length, in the pre-parse
step (objc-rn-extern.ts). The head becomes `@implementation` and the native
class's name, where it stood, which is the second argument of
`RCT_EXTERN_REMAP_MODULE`. Each of React Native's macros among the body's
declarations that has no body of its own is blanked, with its `;`. A macro
followed by `{`, a macro inside a method's braces, comments and strings are
left, and a shim that does not close or does not name a class is left as
written. The React Native bridge finds what a shim exposes from the file's
text as written, so it reads what it read before.

What changes in a graph, measured against main on the six libraries and on
an app written for this:
- each shim has a class named for the native class, not for the macro, and
  the methods written in it, at their own lines, with what they call;
- every JavaScript-to-Swift edge through a shim is as it was, and no
  unresolved reference changes;
- a component whose view manager is a Swift class behind a shim gains the
  `calls` edge the Fabric and Paper pass draws to a native class of the
  conventional name, there being no Objective-C class of that name before;
- an Objective-C reference to the class by name can now land on the shim's
  class node instead of the Swift class, as it already does for any category
  on a Swift class, each `@implementation` being a class node of its own. No
  such reference is in the six libraries.

A file with no shim is untouched. Over the fixtures, this repository's src,
real code in five languages and the generated projects, with the kernel and
with the wasm extractor, the graphs are the same as main's, but for the one
generated project that is a shim.

A 32,000-line shim now indexes in 0.4 seconds, and the benchmark's shim case
(27,000 lines beside the Swift class and its JavaScript callers) in 2 seconds
where it took 18.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…it is written (#3507)

A code-based TanStack route's address is composed through `getParentRoute`,
up to the root. The root was read only when written with an options object,
`createRootRoute({ … })`. Written any other way it was no declaration at
all, every route under it had a parent the file never declared, and the file
gave no route and no navigation. Nothing said so: a tree left uncomposed is
also what a parent in another file looks like.

Two other ways are common:
- with its context's type, where a first call takes nothing and returns the
  factory: `createRootRouteWithContext<{ auth: Auth }>()({ … })`. TanStack's
  kitchen-sink examples and its query examples are written this way, 6 of
  the 28 example apps in its repository that declare routes in code;
- with nothing: `createRootRoute()`, as its docs write it in ten places and
  its tests do.

A root is the root whatever it is given, so it is read in each of those
forms, and as `…<Ctx>()()`, with type arguments on `createRootRoute`, and
with its options in a variable. The type arguments are stepped over with
their braces, parentheses and strings, so the `>` of an arrow in a function
type closes nothing, and ones that never close are no root. A route other
than the root still needs its options written out, since they hold its path,
and a parent declared in another file is still not composed.

Against main, on those 28 apps:
- kitchen-sink and kitchen-sink-react-query, and their Solid twins, go from
  0 routes to 11 each, the 16 declarations less the three layouts an index
  route stands in for and the two pathless ones, each bound to its
  component, with 2 navigation edges;
- basic-react-query and basic-solid-query go from 0 routes to 5 with 6
  navigation edges, which is what basic, whose root has options, gives;
- the two search-validator-adapters apps gain the 4 routes their tests
  declare under a bare root;
- the 20 apps whose root has options are the same, node for node;
- nothing is removed anywhere, and no unresolved reference changes.

Everything that holds no such tree is untouched: over the fixtures, this
repository's src, real code in five languages and the generated projects,
with the kernel and with the wasm extractor, the graphs are the same as
main's but for the one generated project that is a route tree under a bare
root. That project is the benchmark's: 20,000 routes in 3 MB index in 4.4
seconds, the time the same tree takes under a root with options.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
The version in package.json, ui/package.json and package-lock.json, which is
what the Release workflow reads, and the changelog made ready for it: a
Highlights block at the head of [Unreleased], and the 29 fixes grouped by
area now that they are past fifteen. No entry is reworded or dropped.

The workflow promotes [Unreleased] to [1.6.5] itself. Rehearsed on a copy:
prepare-release.mjs renames the block and extract-release-notes.mjs gives
the notes, 39 entries in 9,500 characters.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
[skip ci] Auto-generated by Release workflow.
Integrates colbymchenry/codegraph v1.6.5 (1291 upstream commits since the
v1.4.1 base). The 60 conflicts were all in shared files; no VBA-only file
conflicted. Every conflict is classified in the sync notes.

Fork behaviour kept:
- package identity, release pipeline, pnpm (with a workspace for the
  upstream ui/ viewer), the #332 upgrade behaviour, the gentle-ai
  OpenCode mcp.codegraph entry, the #193 status wording, serverInfo
- VBA graph identical on a 163-file Access corpus apart from 2 bogus
  JSX edges upstream stopped producing

Seams fixed so upstream code does not silently break VBA:
- migrations: upstream 9-16 kept, fork metadata columns moved to 17/18,
  existing fork databases reconciled by column/table existence
- metadata kept through upstream's bulk writes and array-row reader
- the store worker keeps [Event Procedure] event-handler edges
- synthesis refresh no longer deletes VBA-synthesized edges on sync
- kernel kind tables accepted as a prefix (no wasm fallback)
- upstream's test-suite visibility filter skipped for VBA
- EXTRACTION_VERSION 30 (max of both + 1): every index reindexes once

Also: upstream's Pro beta signup is disabled in the fork.

Refs #331
…cord v1.6.5 base

- ui/package.json follows the engine version (3.1.0)
- a database written by fork v3.0.0 (old 9/10 numbering) reaches the
  current schema without losing metadata, idempotently
- the Rust kernel kind tables stay a prefix of the TS tables, checked
  from source so it runs without a kernel binary
- FORK_NOTES records upstream v1.6.5 as the integrated base

Refs #331
… fork names

- build-bundle.sh installs with prefer-symlinked-executables=false, so
  pnpm writes no .bin symlinks on Linux/macOS now that the ui workspace
  brings packages with executables into the production install
- npm-shim and bundle-launcher tests stage the fork's package and
  archive names (@aroman22/codegraph-vba-<target>, codegraph-vba-<target>)
  instead of upstream's

Refs #331
@ardelperal
ardelperal merged commit 43fda59 into main Nov 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(upstream): sync fork with upstream CodeGraph v1.6.2 and ship daemon stop --path